package demo.db.tsdb.prometheus.vo;

import com.alibaba.fastjson.JSON;
import demo.vo.tsdb.TsdbData;

import java.util.List;

public class PromRange {

    private String status;

    private Data data;

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Data getData() {
        return data;
    }

    public void setData(Data data) {
        this.data = data;
    }

    public static class Data {
        /**
         * 响应数据类型
         * <p>
         * <li>区间向量：matrix
         * <pre>[
         *   {
         *     "metric": { "<label_name>": "<label_value>", ... },
         *     "values": [ [ <unix_time>, "<sample_value>" ], ... ]
         *   },
         *   ...
         * ]<pre/>
         * <li>瞬时向量：vector
         * <pre>
         * [
         *   {
         *     "metric": { "<label_name>": "<label_value>", ... },
         *     "value": [ <unix_time>, "<sample_value>" ]
         *   },
         *   ...
         * ]
         * <pre/>
         * <li>标量：scalar,响应格式： [ <unix_time>, "<scalar_value>" ]
         * <li>字符串：string，响应格式：[ <unix_time>, "<string_value>" ]
         */
        private String resultType;

        private List<TsdbData> result;

        public String getResultType() {
            return resultType;
        }

        public void setResultType(String resultType) {
            this.resultType = resultType;
        }

        public List<TsdbData> getResult() {
            return result;
        }

        public void setResult(List<TsdbData> result) {
            this.result = result;
        }
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this, true);
    }
}
